//
//  ContentCell.m
//  Travel
//
//  Created by lanou3g on 15/11/19.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "ContentCell.h"

@implementation ContentCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self layoutSubviews];
    }
    return self;
}

//布局子视图

-(void)layoutSubviews
{
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, 300, 40)];
    self.titleLabel.font = [UIFont systemFontOfSize:17];
    
    
    self.top_leftBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.top_leftBtn.frame = CGRectMake(5, 50, 170, 70);
    self.top_leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 170, 70)];
    
    
    
    self.top_rightBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.top_rightBtn.frame = CGRectMake(180, 50, 170, 70);
    
    
    self.bottom_leftBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.bottom_leftBtn.frame = CGRectMake(5, 130, 170, 70);
    
    
    self.bottom_rightBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.bottom_rightBtn.frame = CGRectMake(180, 130, 170, 70);
    
    
    //添加到父视图
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.top_leftBtn];
    [self.contentView addSubview:self.top_rightBtn];
    [self.contentView addSubview:self.bottom_leftBtn];
    [self.contentView addSubview:self.bottom_rightBtn];
    
    [self.top_leftBtn addSubview:self.top_leftView];
    [self.top_rightBtn addSubview:self.top_rightView];
    [self.bottom_leftBtn addSubview:self.bottom_leftView];
    [self.bottom_rightBtn addSubview:self.bottom_rightView];
    
    
    
}


-(void)setDModel:(DataModel *)dModel
{
    if (_dModel != dModel) {
        _dModel = nil;
        _dModel = dModel;
        
        [self layoutDModel];
    }
}



//给控件赋值
-(void)layoutDModel
{
    self.titleLabel.text = self.tModel.title;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
